Discover document createelement class, include the articles, news, trends, analysis and practical advice about document createelement class on alibabacloud.com
Performance Comparison Between createElement and innerHtml: createelement
In js, there are roughly two ways to add html dynamically. One is to create a document. createElement method, and then add it using Element. appendChild or Element. innerHTML =
// Create a label by defining the Method//*************************************//Copy codeThe Code is as follows:Var createLabel = function (id, name, value ){Var label_var = document. createElement ("label ");Var label_id = document.
//*************************************//
// Create a label by defining the Method
//*************************************//
VaR createlabel = function (ID, name, value ){
VaR label_var = Document. createelement ("label ");
VaR
During web development, JavaScript is often used to dynamically create HTML elements and set relevant attributes. For example, if you want to create a div layer, you can use the following
Code .
1. directly establish
Function
Button1_onclick ()
From lcx's blog
In the WEB standard, you can use getElementById (), getElementsByName (), and getElementsByTagName () to access any tag in the DOCUMENT:
1. getElementById ()GetElementById () can access a specific element in the DOCUMENT. As the name
JS extension class, clone object and mixed class instance analysis class Extension
/* EditInPlaceField class * // * Extension function */function extend (subClass, superClass) {var F = function () {}; F. prototype = superClass. prototype; subClass.
Sometimes we need to generate an xml document as a container for data exchange. Of course, we use the concatenation string method to construct xml, but this method is simple and effective, but if the structure of the xml document is too complicated,
Sometimes we need to generate an XML document as a container for data exchange. Of course, we use the concatenation string method to build the XML, but although this method is simple and effective, but if the XML document structure is too complex,
JS Document attributes and Methods document. title // set the document title is equivalent to the title Tag document of HTML. bgColor // set the background color of the page document. fgColor // set the foreground color (text color) document.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.